package com.financing.wap.dao.impl;

import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;















import com.financing.wap.common.SqlName;
import com.financing.wap.dao.INewsDao;
import com.financing.wap.dto.MessageJpushDTO;
import com.financing.wap.dto.NewsDTO;
import com.financing.wap.dto.TagNewsDTO;
import com.financing.wap.dto.TagProductDTO;
import com.financing.wap.vo.QueryNewsVo;
import com.financing.wap.vo.TagRelateVo;

@Repository("newsDao")
@SuppressWarnings(value={"deprecation","unchecked"})
public class NewsDaoImpl extends BaseDaoImpl<NewsDTO, java.lang.Integer> implements INewsDao {

	@Override
	public List<NewsDTO> getNewsList(QueryNewsVo queryVo) {

		return this.sqlMapClientTemplate.queryForList(SqlName.NEWS_INFO_LIST, queryVo);
	}

	@Override
	public int getNewsListCount(QueryNewsVo queryVo) {

		return (Integer)this.sqlMapClientTemplate.queryForObject(SqlName.NEWS_INFO_LIST_COUNT, queryVo);
	}

	@Override
	public NewsDTO searchNewsById(Integer id) {

		return (NewsDTO)this.sqlMapClientTemplate.queryForObject(SqlName.NEWS_INFO_VIEW, id);
	}

	@Override
	public Class<NewsDTO> getEntityClass() {

		return NewsDTO.class;
	}

	@Override
	public List<TagNewsDTO> getAboutNewsByPid(TagRelateVo  tagRelateVo) {
		return this.sqlMapClientTemplate.queryForList(SqlName.NEWS_ABOUT_PRODUCT_LIST, tagRelateVo);
	}

	@Override
	public Integer getAboutNewsByPidCount(TagRelateVo  tagRelateVo) {
		return (Integer)this.sqlMapClientTemplate.queryForObject(SqlName.NEWS_ABOUT_PRODUCT_COUNT, tagRelateVo);
	}

	@Override
	public List<TagProductDTO> getAboutProductsByPid(TagRelateVo tagRelateVo) {
		return this.sqlMapClientTemplate.queryForList(SqlName.NEWS_ABOUT_LIST, tagRelateVo);
	}

	@Override
	public Integer getAboutProductsByPidCount(TagRelateVo tagRelateVo) {
		return (Integer)this.sqlMapClientTemplate.queryForObject(SqlName.NEWS_ABOUT_COUNT, tagRelateVo);
	}

	@Override
	public List<TagProductDTO> getAboutTagProductsByPid(TagRelateVo tagRelateVo) {
		return this.sqlMapClientTemplate.queryForList(SqlName.NEWS_ABOUT_TAG_PRODUCT_LIST, tagRelateVo);
	}

	@Override
	public Integer getAboutTagProductsByPidCount(TagRelateVo tagRelateVo) {
		return (Integer)this.sqlMapClientTemplate.queryForObject(SqlName.NEWS_ABOUT_TAG_PRODUCT_COUNT, tagRelateVo);
	}

	@Override
	public List<TagProductDTO> getAboutTagNewsByPid(TagRelateVo tagRelateVo) {
		return this.sqlMapClientTemplate.queryForList(SqlName.NEWS_ABOUT_TAG_LIST, tagRelateVo);
	}

	@Override
	public Integer getAboutTagNewsByPidCount(TagRelateVo tagRelateVo) {
		return (Integer)this.sqlMapClientTemplate.queryForObject(SqlName.NEWS_ABOUT_TAG_COUNT, tagRelateVo);
	}

	@Override
	public Map<String, Object> getNewsUpdateDate(Map<String, Object> map) throws SQLException {
		return (Map<String, Object>)this.sqlMapClientTemplate.queryForObject(SqlName.getNewsUpdateDate, map);
	}

	@Override
	public void updateLastDate(Map<String, Object> parMap) {
		this.sqlMapClientTemplate.update(SqlName.updateLastNewsDate, parMap);
	}

	@Override
	public Map<String, Object> getJPushListUpdateDate(Map<String, Object> map) throws SQLException {
		return (Map<String, Object>)this.sqlMapClientTemplate.queryForObject(SqlName.getJPushUpdateDate, map);
	}

	@Override
	public Map<String, Object> getJPushListShopUpdateDate(Map<String, Object> map) throws SQLException {
		return (Map<String, Object>)this.sqlMapClientTemplate.queryForObject(SqlName.getJPushShopUpdateDate, map);
	}

	@Override
	public void updateLastJPushListDate(Map<String, Object> parMap) {
		this.sqlMapClientTemplate.update(SqlName.updateLastJPushDate, parMap);
	}
	@Override
	public void updateLastJPushListShopDate(Map<String, Object> parMap) {
		this.sqlMapClientTemplate.update(SqlName.updateLastJPushShopDate, parMap);
	}
	@Override
	public List<MessageJpushDTO> getJPushList(QueryNewsVo queryVo) {
		return this.sqlMapClientTemplate.queryForList(SqlName.getJPushList, queryVo);
	}
	@Override
	public int getJPushListCount(QueryNewsVo queryVo) {
		return (Integer) this.sqlMapClientTemplate.queryForObject(SqlName.getJPushListCount, queryVo);
	}

	@Override
	public List<MessageJpushDTO> getJPushListShop(QueryNewsVo queryVo) {
		return this.sqlMapClientTemplate.queryForList(SqlName.getJPushListShop, queryVo);
	}
	@Override
	public int getJPushListShopCount(QueryNewsVo queryVo) {
		return (Integer) this.sqlMapClientTemplate.queryForObject(SqlName.getJPushListShopCount, queryVo);
	}
}
